package ligne2vie.topos.client.asynccalls;

import ligne2vie.topos.client.SimpleMessageBox;
import ligne2vie.topos.client.maps.MyMapWidget;
import ligne2vie.topos.shared.bo.TSummit;

import com.google.gwt.user.client.rpc.AsyncCallback;

/**
 * Convenience class to manage summit remote edit result. Displaying the summit on the map once result is received.
 * 
 * @author thuguerre
 * @since 1.0.0
 */
public class EditAndDisplaySummit implements AsyncCallback<TSummit> {

	/**
	 * {@inheritDoc}
	 */
	public void onSuccess(TSummit result) {
		MyMapWidget.getInstance().addSummit(result);
	}

	/**
	 * {@inheritDoc}
	 */
	public void onFailure(Throwable caught) {
		new SimpleMessageBox("Echec...", "Une erreur est survenue pendant la modification du sommet. "
				+ "Veuillez v&eacute;rifier si le sommet a &eacute;t&eacute; correctement modifi&eacute; "
				+ "et recommencez si n&eacute;cessaire. <br /><br />" + caught.getMessage());
	}
}
